package com.zjw.designPattern.proxy.jdkProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class CarBench implements Car {
    @Override
    public void drive() {
        System.out.println("this is 奔驰");
    }

    public static void main(String[] args) {
        InvocationHandler invocationHandler = new ProxyHandle(new CarBench());
        Car proxy = (Car) Proxy.newProxyInstance(CarBench.class.getClassLoader(),CarBench.class.getInterfaces(),invocationHandler);
        proxy.drive();
    }
}
